package com.songlanyun.modules.account.model.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.songlanyun.common.drive.ValueObject;
import com.songlanyun.common.enums.MemberConstant;
import com.songlanyun.common.validator.group.*;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

@Data
public class AccountDTO implements Serializable, ValueObject {


    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups = {AppLoginGroup.class})
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
    /**
     * 注册时的验证码
     **/
//    @NotBlank(message = "验证码不能为空", groups = {AppGroup.class, WxGroup.class, WxLoginGroup.class})
    private String captcha;

    /**
     * 注册时的邀请码
     **/
//    @NotBlank(message = "邀请码不能为空", groups = {AppGroup.class, WxGroup.class})
    private String invitationCode;

    /**
     * 注册时的手机号
     **/
    @NotBlank(message = "手机号不能为空", groups = {AppGroup.class, WxGroup.class, AppLoginGroup.class, WxLoginGroup.class})
    @Pattern(regexp = "^[1][1,2,3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
    private String mobile;

    /**
     * openId
     */
    @NotBlank(message = "openId不能为空", groups = {WxGroup.class})
    private String openId;

    /**
     * 会员注册来源
     * 0：App
     * 1：Wx
     */
    private MemberConstant.RegisterSource registerSource;

    /**
     * unipush的客户端ID，这个id定位了你的手机
     */
    private String cid;

    /**
     *版本号
     */
    private String version;

    /**
     * 类型区分 0为App1为小程序
     */
    private String type;

}
